package com.windgo.controller.wx;

import com.windgo.bean.MarketBrand;
import com.windgo.bean.common.BasePageInfo;
import com.windgo.bean.common.BaseRespVo;
import com.windgo.bean.common.CommonData;
import com.windgo.service.BrandService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author mabai
 * @since 2022/10/14 14:45
 */
@RestController
@RequestMapping("wx/brand")
public class WxBrandController {

    @Autowired
    BrandService brandService;

    /**
     * 给wx小程序分页返回品牌信息
     *
     * @param info
     * @return com.windgo.bean.common.BaseRespVo
     * @author mabai
     * @since 2022/10/14 15:26
     */
    @GetMapping("list")
    public BaseRespVo list(BasePageInfo info) {
        CommonData<MarketBrand> data = brandService.wxList(info);
        return BaseRespVo.ok(data);
    }

    /**
     * 返回品牌详情信息
     *
     * @return com.windgo.bean.common.BaseRespVo
     * @author mabai
     * @since 2022/10/14 15:27
     */
    // /wx/brand/detail
    @GetMapping("detail")
    public BaseRespVo detail(Integer id) {
        MarketBrand data = brandService.brandDetail(id);
        return BaseRespVo.ok(data);
    }
}
